import request from '@/utils/request'

// 查询仓库列表
export function listWarehouse(query) {
  return request({
    url: '/pack/warehouse/list',
    method: 'get',
    params: query
  })
}

// 查询仓库详细
export function getWarehouse(warehouseId) {
  return request({
    url: '/pack/warehouse/' + warehouseId,
    method: 'get'
  })
}

// 新增仓库
export function addWarehouse(data) {
  return request({
    url: '/pack/warehouse',
    method: 'post',
    data: data
  })
}

// 修改仓库
export function updateWarehouse(data) {
  return request({
    url: '/pack/warehouse',
    method: 'put',
    data: data
  })
}

// 删除仓库
export function delWarehouse(warehouseId, force = false) {
  return request({
    url: '/pack/warehouse/' + warehouseId + (force ? '?force=true' : ''),
    method: 'delete'
  })
}

// 获取仓库选择列表
export function warehouseOptionselect() {
  return request({
    url: '/pack/warehouse/optionselect',
    method: 'get'
  })
}

// 库房汇总统计查询
export function getWarehouseSummary(query) {
  return request({
    url: '/pack/warehouse/summary',
    method: 'get',
    params: query
  })
}

// 获取库房汇总详情列表
export function getWarehouseSummaryDetail(query) {
  return request({
    url: '/pack/warehouse/summary/detail',
    method: 'get',
    params: query
  })
}

// 导出库房汇总统计数据
export function exportWarehouseSummary(query) {
  return request({
    url: '/pack/warehouse/summary/export',
    method: 'post',
    data: query
  })
}
